/*
 ----------------------------------------------------------------------------------
                          "THE BEER-WARE COPYRIGHT LICENSE"
                                    (Revision 43)
                                     -----------
   Rymek [rymek@rymek.org] wrote this file. As long as You retain this notice and
   this file has been sent directly to You by the author, You can do whatever You
   want with this stuff as long as You don't sell or rent it. If we meet some day,
   and You think this stuff is worth it, You can buy me a beer in return :-)
                                                                __________
                                                                Paweł Rymaszewski
 ----------------------------------------------------------------------------------
 */

package processing.objects;

/**
 * Class holds search parameters for searching messages
 *
 * @author rymek
 *         User: rymek
 *         Date: 30.06.11
 *         Time: 10:10
 */
public class SearchParameters {

    private String dttmFrom;            // criteria: valid from
    private String dttmTo;              // criteria: valid to
    private String logtype;             // criteria: logtype for sync messages (1 - request, 3 - response)
    private String processingTime;      // criteria: messageInfo processing time
    private Message messageInfo;        // criteria: messageInfo object containing messageInfo info
    private String searchString;        // String (or regexp) to search for in message body
    private boolean includeArchives;    // determines if fetch should include message archives

    public String getProcessingTime() {
        return processingTime;
    }

    public void setProcessingTime(String processingTime) {
        this.processingTime = processingTime;
    }

    public String getDttmFrom() {
        return dttmFrom;
    }

    public void setDttmFrom(String dttmFrom) {
        this.dttmFrom = dttmFrom;
    }

    public String getDttmTo() {
        return dttmTo;
    }

    public void setDttmTo(String dttmTo) {
        this.dttmTo = dttmTo;
    }

    public String getLogtype() {
        return logtype;
    }

    public void setLogtype(String logtype) {
        this.logtype = logtype;
    }

    public Message getMessageInfo() {
        return messageInfo;
    }

    public void setMessageInfo(Message messageInfo) {
        this.messageInfo = messageInfo;
    }

    public String getSearchString() {
        return searchString;
    }

    public void setSearchString(String searchString) {
        this.searchString = searchString;
    }

    public boolean includeArchives() {
        return includeArchives;
    }

    public void setIncludeArchives(boolean includeArchives) {
        this.includeArchives = includeArchives;
    }

    @Override
    public String toString() {
        return "SearchParameters{" +
                "dttmFrom='" + dttmFrom + '\'' +
                ", dttmTo='" + dttmTo + '\'' +
                ", logtype='" + logtype + '\'' +
                ", processingTime='" + processingTime + '\'' +
                ", messageInfo=" + messageInfo +
                ", searchString='" + searchString + '\'' +
                ", includeArchives=" + includeArchives +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof SearchParameters)) return false;

        SearchParameters that = (SearchParameters) o;

        return !(dttmFrom != null ? !dttmFrom.equals(that.dttmFrom) : that.dttmFrom != null) && !(dttmTo != null ? !dttmTo.equals(that.dttmTo) : that.dttmTo != null) && !(logtype != null ? !logtype.equals(that.logtype) : that.logtype != null) && !(messageInfo != null ? !messageInfo.equals(that.messageInfo) : that.messageInfo != null) && !(processingTime != null ? !processingTime.equals(that.processingTime) : that.processingTime != null) && !(searchString != null ? !searchString.equals(that.searchString) : that.searchString != null);
    }

    @Override
    public int hashCode() {
        int result = dttmFrom != null ? dttmFrom.hashCode() : 0;
        result = 31 * result + (dttmTo != null ? dttmTo.hashCode() : 0);
        result = 31 * result + (logtype != null ? logtype.hashCode() : 0);
        result = 31 * result + (processingTime != null ? processingTime.hashCode() : 0);
        result = 31 * result + (messageInfo != null ? messageInfo.hashCode() : 0);
        result = 31 * result + (searchString != null ? searchString.hashCode() : 0);
        return result;
    }
}
